use rbatis::{crud, html_sql, py_sql};
use rbatis::executor::Executor;
use crate::domain::entity::user_entity::UserEntity;

/// UserEntity 基础查询
crud!(UserEntity {}, "api_user");

/// select_user_page 用户分页查询
#[html_sql("src/mapper/xml/user_mapper.html")]
pub async fn select_user_page(rb: &mut dyn Executor,
                              page_num:u64,
                              page_size:u64,
                              username:Option<String>,
                              user_type:Option<u8>)
    -> rbatis::Result<Vec<UserEntity>>{
    impled!()
}



#[html_sql("src/mapper/xml/user_mapper.html")]
pub async fn select_user_page_count(rb: &mut dyn Executor,
                                    username:Option<String>,
                                    user_type:Option<u8>)
    -> rbatis::Result<u64> {
    impled!()
}

#[py_sql(
    "`select t.id, t.username, t.password, t.user_type, t.permission_biz from api_user as t where 1 = 1`
                  if name != '':
                    ` and t.username=#{name}`"
)]
pub async fn select_by_name(rb: &mut dyn Executor, name: &str) -> rbatis::Result<Option<UserEntity>> {
    impled!()
}